// 根据文件类型返回图标
const fileTypes=[
	 "ai"
    ,"apk"
    ,"audio"
    ,"avi"
    ,"bat"
    ,"bmp"
    ,"css"
    ,"csv"
    ,"default"
    ,"doc"
    ,"docx"
    ,"excel"
    ,"exe"
    ,"flv"
    ,"folder"
    ,"gif"
    ,"html"
    ,"image"
    ,"jpg"
    ,"js"
    ,"mov"
    ,"MP3"
    ,"mp4"
    ,"pdf"
    ,"png"
    ,"pps"
    ,"ppsx"
    ,"ppt"
    ,"pptx"
    ,"psd"
    ,"rar"
    ,"raw"
    ,"sketch"
    ,"svg"
    ,"table"
    ,"tif"
    ,"txt"
    ,"video"
    ,"wav"
    ,"word"
    ,"xls"
    ,"xlsb"
    ,"xlsm"
    ,"xlsx"
    ,"xltx"
    ,"zip"];
export function getUrl(url) {
  if (!url) {
    return null
  }
  let def="default";
  let type="";
  if(url.lastIndexOf('.')!=-1){
	 let index = url.lastIndexOf('.');
	 type = url.substring(index + 1);
	 const check=fileTypes.filter(item => item == type);
	 if(check.length!=0){
		 return new URL(`/src/assets/filetype/${type}.png`, import.meta.url).href;
	 }
  }
  return new URL(`/src/assets/filetype/${def}.png`, import.meta.url).href;
}